<#assign module="errand"/>

<@override name="header">
</@override>
<@override name="body">

	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-default">
				<div class="panel-heading">
					新增收费内容
			    </div>
			    <div class="panel-body">
    				<form id="submit_form" action="${ctx}/errand/updatefeecontent" class="form-horizontal" method="post">
		               	<input type="hidden" name="id" value="${errandPay.id}">
		               	<input type="hidden" id="city" name="city" value="${errandPay.city?if_exists}">
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label">已选择:</label>
		                    <div class="col-sm-2">
		                    	<p class="form-control-static">${errandPay.city?if_exists}  <button type="button" id="chose-city" class="btn btn-default btn-xs">重新选择</button></p>
		                    </div>
		                </div>
		                
		                <div id="city-div" class="form-group" style="display:none;">
		                    <label class="col-sm-3 control-label"><em>*</em>城市名：</label>
		                    <div class="col-sm-2">
		                    	<select class="form-control" id="provName"></select>
		                    </div>
		                    <div class="col-sm-2">
		                    	<select class="form-control" id="cityName"></select>
		                    </div>
		                </div>
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>收费内容：</label>
		                    <div class="col-sm-8">
		                    	<textarea class="form-control" cols="20" id="content" name="content" rows="2" required>${errandPay.content?if_exists}</textarea>
		                    </div>
		                </div>
		                
		                <div class="form-group" style="margin-left:10px;">
			                <label class="col-sm-3 control-label"></label>
			                <input id="submit_button" type="submit" class="btn btn-primary" value="保存">
			                <input type="button" class="btn btn-default" onclick="javasccript:window.close();" value="关闭">
			            </div>
			            
					</form>
        		</div>
			</div>
		</div>
	</div>

</@override>
<@override name="footer">
<script src="${ctx}/assets/kindeditor/kindeditor-all-min.js"></script>
<script src="${ctx}/assets/kindeditor/lang/zh_CN.js"></script>
<script src="${ctx}/assets/js/jquery.cityselect.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
	
		$.initProv("#provName", "#cityName");
		$("#cityName").change(function(){
			$("#city").val($("#cityName option:selected").text());
		});
		
		$("#chose-city").click(function(){
			$("#city-div").show();
			$(this).hide();
		});
		
		KindEditor.ready(function(K) {
			window.editor = K.create('#content',{
				filterMode : false,
				allowUpload : false,
				allowFileManager : false,
				height:400,
				resizeType:0,
				items : [
				        'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
				        'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
				        'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
				        'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
				        'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
				        'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|',
				        'flash', 'media', 'insertfile', 'table', 'hr', 'baidumap', 'pagebreak',
				        'anchor', 'link', 'unlink', '|', 'about'
				],
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
					});
				},
				afterBlur:function(){ 
					this.sync();
				}
			});
		});
		
		$("#submit_form").submit(function(){
			
			$("#submit_button").attr("disabled",true);
			
			$.post('${ctx}/errand/updatefeecontent',$("#submit_form").serialize(),function(result){
				if(result.success){
					if(window.opener){
						window.opener.location.reload(true);
					}
					window.close();
				}
				else{
					$.scojs_message(result.message, $.scojs_message.TYPE_ERROR);
				}
			});
			
			return false;
		});
	
	});
</script>
</@override>
<@extends name="../layout.ftl"/>